<template>
	<view style="padding-bottom:50rpx;">
		<!-- <page-head :title="'我的钱包'" :headtype="2"></page-head> -->
		<view class="topblock">
			<image class="topbg" :src="apifun.serveimg+'moneytopbg.png'" mode=""></image>
			<view class="accoundbottom"></view>
			<view class="accoundye marginAuto">
				<view class="accoundye-title">我的钱包（元）</view>
				<view class="accoundye-moeny">
					<text style="font-size:24rpx;">￥</text>
					<text>{{ alldata.money }}</text>
				</view>
				<view class="withbtn mainBg baiColor" @click="apifun.navigate('/pages/my/with')">我要提现</view>	
				<!-- <view class="historicalwith flex" @click="apifun.navigate('/pages/my/withjl')">
					<uv-icon name="info-circle" color="#0E71EB" size="18"></uv-icon>
					<text style="margin-left:10rpx;" class="mainColor">查看历史提现</text>
				</view> -->
			</view>
		</view>
		<view class="runninghead">
			<view class="runningheadmain marginAuto flex">
				<view class="runningtitle">全部流水</view>
				<!-- <view class="runningselect flex">
					<view class="runningstxt" @click="$refs.runningtypeis.open()">
						<text style="color: #9E9E9E;" v-if="!acrunningtype">请选择筛选方式</text>
						<text class="mainColor" v-if="acrunningtype">{{ acrunningtype }}</text>
					</view>
					<uv-icon style="margin-top:4rpx;" name="arrow-down" size="16" color="#9E9E9E"></uv-icon>
				</view> -->
			</view>
		</view>
		<view class="runlist marginAuto">
			<view class="runitem flex" v-for="(item,index) in datas" :key="index">
				<view class="runil">
					<view class="runil-title">{{ item.title }}：{{ item.amount }}</view>
					<view class="runil-time">{{ item.create_time }}</view>
				</view>
				<view class="runir">{{ item.amount }}</view>
			</view>
		</view>
		<uv-picker ref="runningtypeis" :columns="runningtypedata" @confirm="runningtypesefun"></uv-picker>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				apifun:this.apifun,
				alldata:{},
				runningtypedata:[
					['选项1','选项2','选项3','选项4']
				],
				acrunningtype:'',
				datas:[]
			};
		},
		onLoad() {
			this.initData();
		},
		methods: {
			initData(){
				let sendData = {
					page:this.page,
					limit:this.apifun.limit
				}
				this.apifun.unirequest('/coach/user/getMoneyRecord','post',sendData,(res)=>{
					if(res.code === 200){
						let datas = res.data;
						this.alldata = datas;
						if(datas.list.data.length <= 0){
							this.page--;
							return false
						};
						this.datas = [...this.datas,...datas.list.data]
					}else{
						this.apifun.toast(res.msg)
					}
				})
			},
			runningtypesefun(e){
				this.acrunningtype = e.value[0];
			}
		},
		onPullDownRefresh() {
			this.page = 1;
			this.datas = [];
			this.initData();
			uni.stopPullDownRefresh();
		},
		onReachBottom() {
			this.page++;
			this.initData()
		},
	};
</script>

<style scoped lang="scss">
	.topblock{
		position:sticky;
		top: 0;
		z-index:100;
		background: #fff;
		.topbg{
			width: 100%;
			height:300rpx;
		}
		.accoundye{
			position:absolute;
			bottom:20rpx;
			left: 50%;
			width: 90%;
			margin-left: -45%;
			padding:48rpx 0 36rpx;
			.accoundye-title{
				font-size: 28rpx;
				color: #333;
				margin-bottom: 18rpx;
			}
			.accoundye-moeny{
				font-size:60rpx;
				color: #333333;
			}
		}
		.accoundbottom{
			position:absolute;
			bottom:0rpx;
			width: 100%;
			height:40rpx;
			background:#F7F7F7;
			border-top-right-radius:30rpx;
			border-top-left-radius:30rpx;
		}
		.withbtn{
			position: absolute;
			right:10rpx;
			bottom:110rpx;
			width: 130rpx;
			height: 44rpx;
			line-height: 44rpx;
			text-align: center;
			border-radius:10rpx;
			font-size:24rpx;
		}
		.historicalwith{
			margin-top: 10rpx;
			line-height:50rpx;
		}
	}
	.runninghead{
		position: sticky;
		top: 300rpx;
		z-index: 10;
		width: 100%;
		height: 60rpx;
		padding: 10rpx 0 30rpx;
		background: #F7F7F7;
		.runningheadmain{
			width: 690rpx;
			justify-content: space-between;
			.runningtitle{
				font-size: 30rpx;
				color: #333333;
				line-height: 50rpx;
			}
			.runningselect{
				line-height: 50rpx;
				border-radius:4rpx;
				border:1px solid #E4E4E4;
				padding: 0 20rpx;
				.runningstxt{
					font-size: 24rpx;
					margin-right: 10rpx;
				}
			}
		}
	}
	// 列表
	.runlist{
		width: 650rpx;
		padding: 20rpx;
		background: #fff;
		border-radius: 20rpx;
		.runitem{
			padding: 15rpx 0;
			justify-content: space-between;
			.runil{
				.runil-title{
					font-size: 30rpx;
					color: #333333;
					line-height: 50rpx;
				}
				.runil-time{
					font-size:24rpx;
					color:#9E9E9E;
					line-height: 40rpx;
				}
			}
			.runir{
				line-height: 90rpx;
				font-size: 40rpx;
				color: #333333;
				font-weight: 600;
			}
		}
	}
</style>